
#include "UInt64.h"

#include <math.h>

// DEBUG.
#include "Debug.h"

using namespace Riccsson::System;

REGISTER_CLASS_CPP(UInt64)
{

}

//---------------------------------------------------------------------------------------
int UInt64::CompareTo(ulong* value)
{
	return _internalUInt64 > *value ? 1 : _internalUInt64 < *value ? -1 : 0;
}
//---------------------------------------------------------------------------------------
int UInt64::CompareTo(object* value)
{
	if (!(instanceof(value, UInt64)))
		return false;

	return ((UInt64*)value)->_internalUInt64 == _internalUInt64;
}
//---------------------------------------------------------------------------------------
bool UInt64::Equals(ulong* obj)
{
	return _internalUInt64 == *obj;
}
//---------------------------------------------------------------------------------------
bool UInt64::Equals(object* obj)
{
	if (!(instanceof(obj, UInt64)))
		return false;

	return ((UInt64*)obj)->_internalUInt64 == _internalUInt64;
}
//---------------------------------------------------------------------------------------
int UInt64::GetHashCode()
{
	return (int)_internalUInt64;
}
//---------------------------------------------------------------------------------------
TypeCode UInt64::GetTypeCode()
{
	throw;
}
//---------------------------------------------------------------------------------------
// Static.
ulong UInt64::Parse(string* s)
{
	throw;
}
//---------------------------------------------------------------------------------------
// Static.
ulong UInt64::Parse(string* s, IFormatProvider* provider)
{
	throw;
}
//---------------------------------------------------------------------------------------
// Static.
ulong UInt64::Parse(string* s, Globalization::NumberStyles style)
{
	throw;
}
//---------------------------------------------------------------------------------------
// Static.
ulong UInt64::Parse(string* s, Globalization::NumberStyles style, IFormatProvider* provider)
{
	throw;
}
//---------------------------------------------------------------------------------------
GC_PTR<Riccsson::System::string> UInt64::ToString()
{
	int length = (int) log10((double) _internalUInt64);
	char* intToString = new char[length + 2];

	ulong x = _internalUInt64;
	ulong i = (ulong) log10((double) x);
	while(x > 0)
	{
		intToString[i] = (x % 10) + '0';
		x = x / 10;
		i = i - 1;
	}

	intToString[length + 1] = '\0';

	GC_PTR<string> output( new string(intToString) );

	delete intToString;
	intToString = null;

	return output;
}
//---------------------------------------------------------------------------------------
GC_PTR<Riccsson::System::string> UInt64::ToString(IFormatProvider* provider)
{
	throw;
}
//---------------------------------------------------------------------------------------
GC_PTR<Riccsson::System::string> UInt64::ToString(string* format)
{
	throw;
}
//---------------------------------------------------------------------------------------
GC_PTR<Riccsson::System::string> UInt64::ToString(const char* format)
{
	throw;
}
//---------------------------------------------------------------------------------------
GC_PTR<Riccsson::System::string> UInt64::ToString(string* format, IFormatProvider* provider)
{
	throw;
}
//---------------------------------------------------------------------------------------
// Static.
bool UInt64::TryParse(string* s, ulong out result)
{
	throw;
}
//---------------------------------------------------------------------------------------
// Static.
bool UInt64::TryParse(string* s, Globalization::NumberStyles style, IFormatProvider* provider, ulong out result)
{
	throw;
}




//----------------------------------------------------------------------------
// +
UInt64 UInt64::operator+ ( const UInt64 value )
{
	return UInt64(this->_internalUInt64 + value._internalUInt64);
}

//----------------------------------------------------------------------------
// -
UInt64 UInt64::operator- ( const UInt64 value )
{
	return UInt64(this->_internalUInt64 - value._internalUInt64);
}

//----------------------------------------------------------------------------
// *
UInt64 UInt64::operator* ( const UInt64 value )
{
	return UInt64(this->_internalUInt64 * value._internalUInt64);
}

//----------------------------------------------------------------------------
// /
UInt64 UInt64::operator/ ( const UInt64 value )
{
	return UInt64(this->_internalUInt64 / value._internalUInt64);
}
UInt64 UInt64::operator/ ( const int& value )
{
	return UInt64(this->_internalUInt64 / value);
}

//----------------------------------------------------------------------------
// %
UInt64 UInt64::operator% ( const UInt64 value )
{
	return UInt64(this->_internalUInt64 % value._internalUInt64);
}

//----------------------------------------------------------------------------
// ++
long long UInt64::operator++ ()
{
	return this->_internalUInt64++;
}